package com.fp.m7.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection = "accounts")
public class Account implements com.fp.m7.api.model.Account, HasDate {
	private static final long serialVersionUID = -5655271507043835340L;

	@Id
	private ObjectId id;
	private Long date;

	@Indexed(unique = true, dropDups = true)
	private String username;
	private String password;

	private String description;
	private String status;

	@Indexed(unique = true, dropDups = true)
	private String nickname;
	private String avatarUrl;

	private List<Follow> following = new ArrayList<Follow>();

	public ObjectId getId() {
		return id;
	}

	public void setId(Serializable id) {
		this.id = (ObjectId) id;
	}

	@Override
	public Long getDate() {
		return date;
	}

	@Override
	public void setDate(Long date) {
		this.date = date;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public String getAvatarUrl() {
		return avatarUrl;
	}

	public void setAvatarUrl(String avatarUrl) {
		this.avatarUrl = avatarUrl;
	}

	public List<Follow> getFollowing() {
		return following;
	}

	public void setFollowing(List<Follow> following) {
		this.following = following;
	}

	@Override
	public String toString() {
		return new StringBuilder("Account [objectId=").append(id) //
				.append("; username=").append(username) //
				.append("; nickname=").append(nickname) //
				.append("; url=").append(avatarUrl) //
				.append("; auditCD=").append(date) //
				.append("]").toString();
	}

}
